<template>
  <ContentWrap>
    <el-form
      ref="formRef"
      :model="formData"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="日期" prop="orderDate">
        <el-date-picker
          v-model="formData.orderDate"
          clearable
          type="daterange"
          placeholder="选择日期"
        />
      </el-form-item>
      <el-form-item label="生产单号" prop="supplierId">
        <el-input v-model="formData.supplierId" placeholder="请输入供应商" />
      </el-form-item>
      <el-form-item label="订单状态" prop="purchaseType">
        <el-select v-model="formData.purchaseType" placeholder="请选择原料类型">
          <el-option label="请选择" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="交货日期" prop="orderDate">
        <el-date-picker
          v-model="formData.orderDate"
          clearable
          type="daterange"
          placeholder="选择日期"
        />
      </el-form-item>
      <el-form-item label="交货期小于(天)" label-width="120" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="货号" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="客户名称" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="材质名称" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="单据类型" prop="supplierId">
        <el-select v-model="formData.purchaseType" placeholder="请选择">
          <el-option label="请选择" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="品名" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="品名2" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="长" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="宽" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="款式" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="订单号" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="规格" prop="supplierId">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="客户" prop="supplierId">
        <el-select v-model="formData.purchaseType" placeholder="请选择">
          <el-option label="请选择" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="同款PO单" prop="supplierId" label-width="80">
        <el-input v-model="formData.supplierId" />
      </el-form-item>
      <el-form-item label="标记类型" prop="supplierId">
        <el-select v-model="formData.purchaseType" placeholder="请选择">
          <el-option label="请选择" value="" />
        </el-select>
      </el-form-item>
      <el-form-item>
      <!-- </el-form-item>
        <el-checkbox v-model="formData.supplierId" >是否排产入库</el-checkbox>
      <el-form-item> -->
        <el-button @click="resetForm" type="primary">查询</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
      <el-form-item>
        <el-button @click="resetForm">打印</el-button>
        <el-button @click="resetForm">打印标签</el-button>
        <el-button @click="resetForm">结单</el-button>
        <el-button @click="resetForm">取消结单</el-button>
        <el-button @click="resetForm">修改交货日期</el-button>
        <el-button @click="resetForm">修改送货地址与区域</el-button>
        <el-button @click="resetForm">导出Excel</el-button>
        <el-button @click="resetForm">导出XML</el-button>
      </el-form-item>
      <el-form-item>
        <el-button @click="resetForm">单据加急</el-button>
        <el-button @click="resetForm">取消加急</el-button>
        <el-button @click="resetForm">开始排产</el-button>
        <el-button @click="resetForm">停止排产</el-button>
        <el-button @click="resetForm">批量审核</el-button>
        <el-button @click="resetForm">取消审核</el-button>
        <el-button @click="resetForm">制版完成</el-button>
        <el-button @click="resetForm">取消制版完成</el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>
  <!-- 列表 -->
  <ContentWrap>
    <ReusableTable
      :tableData="tableData"
      :columns="columns"
      :loading="loading"
    />
  </ContentWrap>
  <!-- 列表 -->
  <ContentWrap>
    <el-tabs
      v-model="tabSelected"
    >
      <el-tab-pane v-for="tab in tabs" 
        :key="tab.label"
        :label="tab.label" :name="tab.name">
        <ReusableTable
          :tableData="tab.data"
          :columns="tab.column"
          :loading="tab.loading"
        />
      </el-tab-pane>
    </el-tabs>
  </ContentWrap>
</template>
<script setup lang="ts">
const loading = ref(false) // 表单的加载中：1）修改时的数据加载；2）提交的按钮禁用

const formData = ref({
  id: undefined,
  purchaseOrderNo: undefined,
  supplierId: undefined,
  supplierName: undefined,
  purchaseType: undefined,
  orderDate: undefined,
})

const tableData = ref([])
const columns = ref([
  { "label": "生产单号", "prop": "productionOrderNo" },
  { "label": "订单日期", "prop": "orderDate", "type": "date" },
  { "label": "交货日期", "prop": "deliveryDate", "type": "date" },
  { "label": "订单类型", "prop": "orderType" },
  { "label": "单位", "prop": "unit" },
  { "label": "订单号", "prop": "orderNo" },
  { "label": "产品编号", "prop": "productCode" },
  { "label": "产品名称", "prop": "productName" },
  { "label": "品名2", "prop": "productName2" },
  { "label": "客户编号", "prop": "customerCode" },
  { "label": "客户简称", "prop": "customerShortName" },
  { "label": "盒型名称", "prop": "boxTypeName" },
  { "label": "款型", "prop": "style" },
  { "label": "材质名称", "prop": "materialName" },
  { "label": "材质", "prop": "material" },
  { "label": "生产材质", "prop": "productionMaterial" },
  { "label": "生产材质名称", "prop": "productionMaterialName" },
  { "label": "长", "prop": "length" },
  { "label": "宽", "prop": "width" },
  { "label": "高", "prop": "height" },
  { "label": "产品规格", "prop": "productSpec" },
  { "label": "订单数", "prop": "orderQuantity" },
  { "label": "备品数", "prop": "spareQuantity" },
  { "label": "生产数", "prop": "productionQuantity" },
  { "label": "材质类型", "prop": "materialType" },
  { "label": "单价", "prop": "unitPrice" },
  { "label": "单重", "prop": "singleWeight" },
  { "label": "体积", "prop": "volume" },
  { "label": "排产数", "prop": "schedulingQuantity" },
  { "label": "入库数", "prop": "inboundQuantity" },
  { "label": "送货数", "prop": "deliveryQuantity" },
  { "label": "印色", "prop": "printColor" },
  { "label": "生产长", "prop": "productionLength" },
  { "label": "生产宽", "prop": "productionWidth" },
  { "label": "生产高", "prop": "productionHeight" },
  { "label": "生产规格", "prop": "productionSpec" },
  { "label": "模板切号", "prop": "templateCutNo" },
  { "label": "采购员", "prop": "purchaser" },
  { "label": "建单日期", "prop": "orderCreationDate", "type": "date" },
  { "label": "面积单价", "prop": "areaUnitPrice" },
  { "label": "审核", "prop": "audit", type: "cheeckbox" },
  { "label": "面积", "prop": "area" },
  { "label": "月结", "prop": "monthlySettlement" },
  { "label": "包装数", "prop": "packingQuantity" },
  { "label": "备注", "prop": "remark" },
  { "label": "结单", "prop": "closeOrder" },
  { "label": "打印", "prop": "print" },
  { "label": "备注2", "prop": "remark2" },
  { "label": "模切算料", "prop": "dieCutCalculation" },
  { "label": "模板宽", "prop": "templateWidth" },
  { "label": "模板长", "prop": "templateLength" },
  { "label": "模板数", "prop": "templateQuantity" },
  { "label": "BOM编号", "prop": "bomNo" },
  { "label": "内订单号", "prop": "internalOrderNo" },
  { "label": "产品类型", "prop": "productType" },
  { "label": "表面处理", "prop": "surfaceTreatment" },
  { "label": "排产工艺", "prop": "schedulingProcess" },
  { "label": "客户单号", "prop": "customerOrderNo" },
  { "label": "配比数", "prop": "ratioQuantity" },
  { "label": "产品单位", "prop": "productUnit" },
  { "label": "组件", "prop": "component" },
  { "label": "项目号", "prop": "projectNo" },
  { "label": "客户材质", "prop": "customerMaterial" },
  { "label": "产品描述", "prop": "productDescription" },
  { "label": "产品备注1", "prop": "productRemark1" },
  { "label": "产品备注2", "prop": "productRemark2" },
  { "label": "产品备注3", "prop": "productRemark3" },
  { "label": "产品备注4", "prop": "productRemark4" },
  { "label": "产品备注5", "prop": "productRemark5" },
  { "label": "产品备注6", "prop": "productRemark6" },
  { "label": "钉条", "prop": "nailStrip" },
  { "label": "加分", "prop": "bonusPoints" },
  { "label": "外购", "prop": "externalPurchase" },
  { "label": "生产工艺", "prop": "productionProcess" },
  { "label": "套数", "prop": "setQuantity" },
  { "label": "厚度", "prop": "thickness" },
  { "label": "排产数", "prop": "schedulingQuantity" },
  { "label": "原料采购数", "prop": "rawMaterialPurchaseQuantity" },
  { "label": "原料入库数", "prop": "rawMaterialInboundQuantity" },
  { "label": "原料领用数", "prop": "rawMaterialIssueQuantity" },
  { "label": "单据状态", "prop": "documentStatus" },
  { "label": "金额", "prop": "amount" },
  { "label": "未送数", "prop": "undeliveredQuantity" },
  { "label": "排产面积", "prop": "schedulingArea" },
  { "label": "入库面积", "prop": "inboundArea" },
  { "label": "送货面积", "prop": "deliveryArea" },
  { "label": "未入库数", "prop": "uninboundQuantity" },
  { "label": "未入库面积", "prop": "uninboundArea" },
  { "label": "未送货面积", "prop": "undeliveredArea" },
  { "label": "未入库金额", "prop": "uninboundAmount" },
  { "label": "送货金额", "prop": "deliveryAmount" },
  { "label": "未送金额", "prop": "undeliveredAmount" },
  { "label": "入库金额", "prop": "inboundAmount" },
  { "label": "客户手工单号", "prop": "customerManualOrderNo" },
  { "label": "总面积", "prop": "totalArea" },
  { "label": "面积单价", "prop": "areaUnitPrice" },
  { "label": "附加费", "prop": "additionalFee" },
  { "label": "对照幅宽", "prop": "referenceWidth" },
  { "label": "计价幅宽", "prop": "pricingWidth" },
  { "label": "同款", "prop": "sameModel" },
  { "label": "拼单编号", "prop": "mergeOrderNo" },
  { "label": "备注1", "prop": "remark1" },
  { "label": "参数1", "prop": "parameter1" },
  { "label": "修改人", "prop": "modifier" },
  { "label": "修改时间", "prop": "modificationTime", "type": "date" },
  { "label": "审核人", "prop": "auditor" },
  { "label": "审核时间", "prop": "auditTime", "type": "date" },
  { "label": "包装方式", "prop": "packagingMethod" },
  { "label": "未排产数", "prop": "unscheduledQuantity" },
  { "label": "未排产面积", "prop": "unscheduledArea" },
  { "label": "库存数", "prop": "inventoryQuantity" },
  { "label": "总体积", "prop": "totalVolume" },
  { "label": "楞型", "prop": "corrugatedType" },
  { "label": "宽开", "prop": "wideOpening" },
  { "label": "压线", "prop": "creaseLine" },
  { "label": "压线类型", "prop": "creaseLineType" },
  { "label": "拼单信息", "prop": "mergeOrderInfo" },
  { "label": "停止排产", "prop": "stopScheduling" },
  { "label": "送货地址", "prop": "deliveryAddress" },
  { "label": "区域", "prop": "region" },
  { "label": "总长", "prop": "totalLength" },
  { "label": "送货排程数", "prop": "deliverySchedulingQuantity" },
  { "label": "制版完成", "prop": "plateMakingCompleted" },
  { "label": "纸箱关联纸板入库数", "prop": "cartonAssociatedBoardInboundQuantity" },
  { "label": "加价", "prop": "additionalPrice" },
  { "label": "标记1", "prop": "mark1" },
  { "label": "规格", "prop": "specification" },
  { "label": "压线和", "prop": "creaseLineSum" },
  { "label": "采购规格", "prop": "purchaseSpecification" },
  { "label": "备注21", "prop": "remark21" },
  { "label": "关联单号", "prop": "relatedOrderNo" },
  { "label": "纸板单", "prop": "boardOrder" },
  { "label": "纸板排产数", "prop": "boardSchedulingQuantity" },
  { "label": "纸板是否排产", "prop": "isBoardScheduled" },
  { "label": "存在同款单", "prop": "hasSameModelOrder" },
  { "label": "印刷版号", "prop": "printPlateNo" },
  { "label": "参数11", "prop": "parameter11" },
  { "label": "利润率", "prop": "profitMargin" },
  { "label": "平方差价", "prop": "squarePriceDifference" },
  { "label": "原纸占比", "prop": "originalPaperRatio" },
  { "label": "退货数", "prop": "returnQuantity" },
  { "label": "工艺完成情况", "prop": "processCompletionStatus" },
  { "label": "计算宽", "prop": "calculatedWidth" },
  { "label": "上传文件日期", "prop": "fileUploadDate", "type": "date" },
  { "label": "是否上传文件", "prop": "isFileUploaded" },
  { "label": "成本单价", "prop": "costUnitPrice" },
  { "label": "面积成本价", "prop": "areaCostPrice" },
  { "label": "成本金额", "prop": "costAmount" },
  { "label": "接单差额", "prop": "orderDifference" },
  { "label": "财务审核", "prop": "financialAudit" },
  { "label": "财务审核人", "prop": "financialAuditor" },
  { "label": "财务审核时间", "prop": "financialAuditTime", "type": "date" }
])

const tabSelected = ref('purchase')

const tabs = ref([
  {
    "label": "采购",
    "name": "purchase",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "原料入库",
    "name": "rawMaterialInbound",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "原料领用",
    "name": "rawMaterialIssue",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "原料退货",
    "name": "rawMaterialReturn",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "成品入库",
    "name": "finishedProductInbound",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "成品退货",
    "name": "finishedProductReturn",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "成品调整",
    "name": "finishedProductAdjustment",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "成品送货明细",
    "name": "deliveryDetails",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "完工记录",
    "name": "productionCompletionRecord",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "配置",
    "name": "configuration",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "外购入库",
    "name": "purchasedGoodsInbound",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "外购退货",
    "name": "purchasedGoodsReturn",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "外协入库",
    "name": "outsourcedInbound",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "外协退货",
    "name": "outsourcedReturn",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "生产排产",
    "name": "productionScheduling",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "外协采购",
    "name": "outsourcingPurchase",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "套件材料",
    "name": "kitMaterials",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "辅料采购",
    "name": "accessoryPurchase",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "辅料入库",
    "name": "accessoryInbound",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "套件领用",
    "name": "kitIssue",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "生产总排",
    "name": "overallProductionPlan",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "纸板排产",
    "name": "corrugatedBoardScheduling",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "送货排程",
    "name": "deliveryScheduling",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "成品领用",
    "name": "finishedProductIssue",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "同款单",
    "name": "sameModelOrder",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "半成品领用",
    "name": "semiFinishedIssue",
    "data": [],
    "loading": false,
    "column": []
  },
  {
    "label": "辅料领用",
    "name": "accessoryIssue",
    "data": [],
    "loading": false,
    "column": [
      { label: '领用单号', prop: 'receiveOrderNo' },
      { label: '标签号', prop: 'labelNo' },
      { label: '仓库编号', prop: 'warehouseCode' },
      { label: '仓库名称', prop: 'warehouseName' },
      { label: '物料编号', prop: 'materialCode' },
      { label: '物料名称', prop: 'materialName' },
      { label: '规格', prop: 'specification' },
      { label: '型号', prop: 'model' },
      { label: '单位', prop: 'unit' },
      { label: '领用数量', prop: 'quantity' },
      { label: '摘要', prop: 'summary' },
      { label: '生产单号', prop: 'productionOrderNo' },
      { label: '创建人', prop: 'createdBy' },
      { label: '创建时间', prop: 'createTime', type: 'date' },
      { label: '修改人', prop: 'updatedBy' },
      { label: '修改时间', prop: 'updateTime', type: 'date' },
      { label: '单价', prop: 'unitPrice' },
      { label: '金额', prop: 'amount' },
      { label: '备注', prop: 'remark' },
      { label: '手工单号', prop: 'manualOrderNo' },
      { label: '领用日期', prop: 'receiveDate', type: 'date' },
      { label: '拼单信息', prop: 'mergeOrderInfo' },
      { label: '拼单号', prop: 'mergeOrderNo' },
      { label: '领用人编号', prop: 'receiverCode', width: 120 },
      { label: '领用人', prop: 'receiverName' },
      { label: '领用部门', prop: 'receiverDepartment' },
      { label: '物料类型', prop: 'materialType' },
      { label: '车间', prop: 'workshop' }
    ]
  }
])

const resetForm = () => {
  // 
}

</script>